package com.xfcycle.zebrabikegp.assist;

import android.bluetooth.BluetoothDevice;

import java.util.HashMap;
import java.util.Map;

/**
 * 蓝牙辅助判断类
 * Created by Wilson on 2017/7/7.
 */

public class BlueToothAssist {

    //该两类用于辅助判断设备是否与手机相连 及锁状态 防止设备主动断开而手机无法及时反映
    public static boolean isUnlock = false;
    public static boolean isConnect = false;

    public static String currentConnectBikeId = null;

    public static boolean isConnecting = false;

    public static String connectDeviceName = "";

    //搜索到的蓝牙设备列表
    private static Map<String,BluetoothDevice> bluetoothDeviceMap;

    private BlueToothAssist(){
        bluetoothDeviceMap = new HashMap<>();
    }

    private static BlueToothAssist instance;

    public static BlueToothAssist getInstance(){
        if(null == instance){
            instance = new BlueToothAssist();
        }
        return instance;
    }

    /**
     * 设备列表添加数据
     */
    public void addDevice(String deviceMacAddress,BluetoothDevice device){
        bluetoothDeviceMap.put(deviceMacAddress,device);
    }

    /**
     * 设备列表获取连接设备
     */
    public BluetoothDevice getDeviceByMacAddress(String deviceMacAddress){
        return bluetoothDeviceMap.get(deviceMacAddress);
    }
}
